<?php
if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Template for Article->Article->Editor
 * used from article.page.editor.php
 * 
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
?>
<script type="text/javascript">
	// JavaScript Document
	//create onDomReady Event
	window.onDomReady = initReady;

	// Initialize event depending on browser
	function initReady(fn) {
		//W3C-compliant browser
		if (document.addEventListener) {
			document.addEventListener("DOMContentLoaded", fn, false);
		} else {
			document.onreadystatechange = function () {
				readyState(fn)
			}
		}
	}
	//IE execute function
	function readyState(func) {
		// DOM is ready
		if (document.readyState == "interactive" || document.readyState == "complete") {
			func();
		}
	}
	function showdiv(nr) {
		for (i = 1; i < 7; i++) {
			if (nr == i) {
				document.getElementById("article_tab" + i).style.display = 'block';
				if (nr == 2) {
					//document.getElementsByClassName("NFSelect")[1].style.position= 'relative';
					document.getElementsByClassName("NFSelect")[2].style.position = 'relative';
					document.getElementsByClassName("NFSelect")[3].style.position = 'relative';
					document.getElementsByClassName("NFSelect")[4].style.position = 'relative';
					//document.getElementsByClassName("NFSelect")[5].style.position = 'relative';
					//document.getElementsByClassName("NFSelect")[6].style.position = 'relative';
					
					var pl = document.getElementById("priceFixx").value;
					setPricelist(parseFloat(pl.replace(/,/, ".")));
				}
			} else {
				document.getElementById("article_tab" + i).style.display = 'none';
			}
		}
	}
	function onReady() {
		showdiv(1);
	}
	function setPricelist() {
		
		var pl = document.getElementById("priceFixx").value;
		var value = parseFloat(pl.replace(/,/, "."));

		if (value > 0) {
			document.getElementById("priceLists").style.display = 'none';
		} else {
			document.getElementById("priceLists").style.display = 'block';
		}
	}
</script>

<h2>{pageTitle}</h2>
<div id="article_edit_tabs">
	<ul>
		<li><a href="javascript:showdiv(1);"><span>{tab1}</span></a></li>
		<li><a href="javascript:showdiv(2);"><span>{tab2}</span></a></li>
		<li><a href="javascript:showdiv(3);"><span>{tab3}</span></a></li>
		<li><a href="javascript:showdiv(4);"><span>{tab4}</span></a></li>
		<li><a href="javascript:showdiv(5);"><span>{tab5}</span></a></li>
		<li><a href="javascript:showdiv(6);"><span>{tab6}</span></a></li>
	</ul>
</div>

<div class="form">
	<form action="{formStart}" method="post" class="niceform fieldset" enctype="multipart/form-data">
		<fieldset>
			<!-- Tab 1 ************************************************************-->
			<div id="article_tab1" style="display:block; ">
				<dl>
					<dt>{id}</dt>
					<dd>{idx}</dd>
				</dl>

				<dl>
					<dt><label for="skux">{sku}</label></dt>
					<dd>
						{skux}
						{articleSkuHelp}
					</dd>
				</dl>

				<dl>
					<dt><label for="namex">{name}</label></dt>
					<dd>
						{namex}
						{articleNameHelp}
					</dd>
				</dl>

				<dl>
					<dt><label for="categoryx">{category}</label></dt>
					<dd>
						{categoryx}
						{articleCategoryHelp}
					</dd>
				</dl>

				<dl>
					<dt><label for="activex">{active}</label></dt>
					<dd>
						{activex}
						{articleActiveHelp}
					</dd>
				</dl>
				<dl>
					<dt><label for="browsepagex">{browsepage}</label></dt>
					<dd>
						<select style="width:350px;" size="1" name="browsepagex" id="browsepagex">
							<!-- BEGIN browsepages -->
							<option value="{browsepage_nrx}" {checkedx}>{browsepage_textx}</option>
							<!-- END browsepages -->
						</select>
						{articleBrowsepageHelp}
					</dd>
				</dl>
				<dl>
					{shorttext}<br>
					{shorttextx}<br>
					{shortDescriptionHelp}
				</dl>

				<dl>
					{text}<br>
					{textx}<br>
					{longDescriptionHelp}
				</dl>

				<dl>
					<dt></dt>
					<dd></dd>
				</dl>

				<dl>
					{textHelp}
				</dl>
			</div>
			<!-- Tab 2 ************************************************************-->
			<div id="article_tab2" style="display:block;">
				<br>
				<dl>
					<dt><label for="stocksx">{stocks}</label></dt>
					<dd>
						{stocksx}&nbsp&nbsp
						{articleStockHelp}
					</dd>
				</dl>

				<dl>
					<dt><label for="taxx">{tax}</label></dt>
					<dd>
						<div class="option-left">
							<select style="width:380px;" size="1" name="taxx" id="taxx">
								<!-- BEGIN taxx -->
								<option value="{taxValuex}" {selectx}>{taxNamex}</option>
								<!-- END taxx -->
							</select>
						</div>
						<div class="option-help">
							{articleTaxHelp}
							</a>
						</div>
						<div class="clear"></div>
					</dd>
				</dl>

				<dl>
					<dt><label for="attributpagex">{attributpage}</label></dt>
					<dd>
						<div class="option-left">
							<select style="width:380px;" size="1" name="attributpagex" id="attributpagex">
								<!-- BEGIN attributes -->
								<option value="{attribute_nrx}" {checkedx}>{attribute_titelx}</option>
								<!-- END attributes -->
							</select>
						</div>
						<div class="option-help">
							{articleAttributeHelp}
							</a>
						</div>
						<div class="clear"></div>
					</dd>
				</dl>

				<dl>
					<p><hr></p>
					<dt><label for="priceFixx">{priceFix}</label></dt>
					<dd>
						{priceFixx}
						{articlePriceFixHelp}
					</dd>
				</dl>
				<div id="priceLists" style="display:block; ">
					<dl>
						<dt><label for="pricex">{price}</label></dt>
						<dd>
							<div class="option-left" style="width:380px;">
								<select select="5" style="width:380px;" size="1" name="pricex" id="pricex">
									<!-- BEGIN pricex -->
									<option value="{priceValuex}" {selectx}>{priceNamex}</option>
									<!-- END pricex -->
								</select>
							</div>
							<div class="option-help">
								{articlePriceHelp}
							</div>
						</dd>
					</dl>
				</div>
			</div>

			<!-- Tab 3 ************************************************************-->
			<div id="article_tab3" style="display:block;">
				<dl>
					<dt><label for="imagex">{image}</label></dt>
					<dd>
						{imagex}<br>
						<div class="notes">
							{imageNote}<br>
							{imageName}
						</div>
						{articleImageHelp}
					</dd>
				</dl>
				<dl>
					<dt></dt>
					<dd>
						{imagey}
					</dd>
				</dl> 
				<br><br><br>
				<dl>
					<dt><label for="thumbImagex">{thumbImage}</label></dt>
					<dd>
						{thumbImagex}<br>
						<div class="notes">
							{thumbImageNote}<br>
							{thumbImageName}
						</div>
						{articleThumbimageHelp}
					</dd>
				</dl>
				<dl>
					<dt></dt>
					<dd>{thumbImagey}</dd>
				</dl> 
			</div>
			<!-- Tab 4 ************************************************************-->
			<div id="article_tab4" style="display:block;">

			</div>
			<!-- Tab 5 ************************************************************-->
			<div id="article_tab5" style="display:block;">
				<dl>
					<dt>{metadescription}</dt>
					<dd>{metadescriptionx}
						<br><br><br>{descriptionNumber}
						{articleMetadescriptionHelp}
					</dd>
					</dd>
				</dl>

				<dl>
					<dt>{metakey}</dt>
					<dd>{metakeyx}
						<br><br><br>{keywordNumber}
						{articleMetakeyHelp}
					</dd>
					</dd>
				</dl>
			</div>
			<!-- Tab 6 ************************************************************-->
			<div id="article_tab6" style="display:block;">
				<dl>
					<dt>{sales}</dt>
					<dd>{salesx}</dd>
				</dl>

				<dl>
					<dt>{create}</dt>
					<dd>{createx}</dd>
				</dl>

				<dl>
					<dt>{lastChange}</dt>
					<dd>{lastChangex}</dd>
				</dl>
			</div>

			<dl class="submit">
				{btnSave}
				{btnRefresh}
				{btnAbort}
			</dl>
		</fieldset>
	</form>
	<script language="JavaScript">
		<!--
		window.onDomReady(onReady);
		
-->
	</script>
</div>
<script type="text/javascript" src="{tpl_js}ckeditor.article.js"></script>	
<script type="text/javascript">
		function validate_editor() {
			// To solve the error of using Ckeditor with jqury validation
			CKEDITOR.instances.content.updateElement();
		}
</script>